import 'package:demo/config/app_resource.dart';
import 'package:demo/event/event_setting.dart';
import 'package:demo/tools/tools_enum.dart';
import 'package:demo/tools/tools_sqlite.dart';

// 群聊接口
class JsonGroup {
  // 群聊列表
  static Future<List<ChatGroup>> getGroupList() async {
    List<String> portraitList = [
      AppImage.i5,
      AppImage.i6,
      AppImage.i7,
      AppImage.i8,
      AppImage.i9,
    ];
    List<ChatGroup> dataList = [];
    for (var i = 1; i < 6; i++) {
      dataList.add(ChatGroup(
        '123456789123456789$i',
        '群聊$i',
        '6666666$i',
        portraitList[i - 1],
        '',
        'N',
        'N',
      ));
    }
    // 存储
    await ToolsSqlite().group.addBatch(dataList);
    // 通知
    EventSetting().event.add(SettingModel(SettingType.group));
    return dataList;
  }
}
